package com.vterm4aKafka.springBootInterceptor;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 添加拦截器
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry){
        //配置拦截接口地址
//        registry.addInterceptor(authenticationInterceptor()).addPathPatterns("/**");

        //设置放行接口地址
        registry.addInterceptor(authenticationInterceptor()).excludePathPatterns("/vterm/fourAInfoSearch");
    }

    //注册自定义拦截器
    @Bean
    public MyInterceptor authenticationInterceptor() {
        return new MyInterceptor();
    }

}